//
//  PKPayChooseView.swift
//  Panku
//
//  Created by mac on 2017/5/28.
//  Copyright © 2017年 Monster. All rights reserved.
//

import UIKit

class PKPayChooseView: PKBaseView {
    
    //MARK: - UI
    lazy var coverView = UIView()
    lazy var containerView = UIView()
    lazy var payLabel = UILabel()
    lazy var alipayButton = PKBaseButton.createButton()
    lazy var wechatPayButton = PKBaseButton.createButton()
    lazy var totalAmount = UILabel()
    lazy var confirmPayButton = PKBaseButton.createButton()
    lazy var dismissButton = PKBaseButton.createButton()

    override func setupView() {
        self.addSubview(coverView)
        self.addSubview(payLabel)
        self.addSubview(containerView)
        self.addSubview(alipayButton)
        self.addSubview(wechatPayButton)
        self.addSubview(totalAmount)
        self.addSubview(confirmPayButton)
        
        
        payLabel.text = "付款详情"
        payLabel.textColor = UIColor(hexString: "242424")
        coverView.backgroundColor = UIColor.black
        coverView.alpha = 0.3
        
        containerView.backgroundColor = UIColor.white
        containerView.layer.cornerRadius = 5
        containerView.layer.masksToBounds = true
        
        alipayButton.titleLabel?.font = UIFont.PKFont(Size: 15)
        alipayButton.setTitleColor(UIColor(hexString: "656565"), for: .normal)
        alipayButton.setTitle("支付宝", for: .normal)
        alipayButton.addBlock(for: .touchUpInside) { (_) in
            //alipay
        }
        
        wechatPayButton.titleLabel?.font = UIFont.PKFont(Size: 15)
        wechatPayButton.setTitleColor(UIColor(hexString: "656565"), for: .normal)
        wechatPayButton.setTitle("微信支付", for: .normal)
        wechatPayButton.addBlock(for: .touchUpInside) { (_) in
            //微信支付
        }
        
        totalAmount.text = "需付款:"
        totalAmount.textColor = UIColor(hexString: "303030")
        totalAmount.font = UIFont.PKFont(Size: 14)
        
        confirmPayButton.setTitleColor(UIColor(hexString: "F4F4F4"), for: .normal)
        confirmPayButton.setTitle("确认付款", for: .normal)
        confirmPayButton.layer.cornerRadius = 5
        confirmPayButton.layer.masksToBounds = true
        confirmPayButton.backgroundColor = UIColor(hexString: "333333")
        
        dismissButton.setImage(R.image.publish_dismiss(), for: .normal)
        
        coverView.snp.makeConstraints { (make) in
            make.edges.equalTo(self)
        }
        
        containerView.snp.makeConstraints { (make) in
            make.center.equalTo(self.snp.center)
            make.left.equalTo(self.snp.left).offset(50)
            make.right.equalTo(self.snp.right).offset(50)
            make.top.equalTo(self.snp.top).offset(265)
            make.bottom.equalTo(self.snp.bottom).offset(265)
        }
        
        dismissButton.snp.makeConstraints { (make) in
            make.top.equalTo(containerView.snp.top).offset(7)
            make.left.equalTo(containerView.snp.left).offset(7)
        }
        
        payLabel.snp.makeConstraints { (make) in
            make.centerX.equalTo(containerView.snp.centerX)
            make.top.equalTo(containerView.snp.top).offset(7)
        }
        
        alipayButton.snp.makeConstraints { (make) in
            make.left.equalTo(containerView.snp.left)
            make.right.equalTo(containerView.snp.right)
            make.top.equalTo(containerView.snp.top).offset(44)
            make.height.equalTo(44)
        }
        
        wechatPayButton.snp.makeConstraints { (make) in
            make.left.equalTo(containerView.snp.left)
            make.right.equalTo(containerView.snp.right)
            make.top.equalTo(alipayButton.snp.bottom)
            make.height.equalTo(44)

        }
        
        totalAmount.snp.makeConstraints { (make) in
            make.left.equalTo(containerView.snp.left)
            make.right.equalTo(containerView.snp.right)
            make.top.equalTo(wechatPayButton.snp.bottom)
            make.height.equalTo(44)
        }
        
        confirmPayButton.snp.makeConstraints { (make) in
            make.left.equalTo(containerView.snp.left).offset(35)
            make.right.equalTo(containerView.snp.right).offset(35)
            make.height.equalTo(44)
            make.bottom.equalTo(containerView.snp.bottom).offset(20)
        }
        
    }

}
